package com.zznj.xzjc.adapter.index;

import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.bean.index.PushData;
import com.zznj.xzjc.utils.StringUtils;
import com.zznj.xzjc.utils.TimeUtils;

import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class PushAdapter extends BaseQuickAdapter<PushData, BaseViewHolder> {
    private int readType;
    public PushAdapter(int layoutResId, @Nullable List<PushData> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PushData item) {
        helper.setText(R.id.msgTitle,item.getTitle())
                .setText(R.id.msgTime, TimeUtils.computeFromNowStr(item.getCreateTime()))
                .setText(R.id.msgContent,item.getContent());
        ImageView msgLogo = helper.getView(R.id.msgLogo);
        if(item.getMsgType() == 1){
            msgLogo.setImageResource(R.mipmap.ic_push_xs_img);
        }else if(item.getMsgType() == 2){
            msgLogo.setImageResource(R.mipmap.ic_push_jcjy_img);
        }else if(item.getMsgType() == 3){
            msgLogo.setImageResource(R.mipmap.ic_push_hdlx_img);
        }else if(item.getMsgType() == 4){
            msgLogo.setImageResource(R.mipmap.ic_push_ajyj_img);
        }
    }
}
